package com.qingcheng.consumer;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.thymeleaf.TemplateEngine;

import java.io.UnsupportedEncodingException;

/**
 * 根据SpuId生成商品详情页
 */
public class CreatePage implements MessageListener {

    @Autowired
    private PageUtil pageUtil;


    @Override
    public void onMessage(Message message) {

        try {
            //获取传来的mapJsonString数据
            String mapJsonString = new String(message.getBody(),"UTF-8");
            System.out.println("根据SpuId生成商品详情页");
            pageUtil.createPage(mapJsonString);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }



    }
}
